package API.DAY10.map;

import java.util.HashMap;
import java.util.Map;

public class MapDemo1 {
    public static void main(String[] args) {
        Map<String,Integer> map = new HashMap<>();
        Integer value = map.put("张三", 90);
        System.out.println(value);
        map.put("李四", 80);
        map.put("王五", 70);
        map.put("赵六", 60);
        map.put("田七", 59);
        System.out.println(map);
        value=map.put("张三", 61);
        System.out.println(value);
        System.out.println(map);

        value = map.get("田七");
        System.out.println(value);
        value = map.get("田八");
        System.out.println(value);

        int size = map.size();
        System.out.println("size:"+size);

        value = map.remove("田七");
        System.out.println(value);
        System.out.println(map);

        boolean isEmpty = map.isEmpty();
        System.out.println("是否为空Map:"+isEmpty);

        boolean ck = map.containsKey("张三");
        System.out.println("是否包含key:"+ck);
        ck = map.containsKey("赵某");
        System.out.println("是否包含key:"+ck);

        boolean ck2 = map.containsValue(61);
        System.out.println("是否包含value:"+ck2);
        ck2 = map.containsKey(100);
        System.out.println("是否包含value:"+ck2);

        map.clear();
        System.out.println(map);
    }
}
